<?php
namespace app\common\validate\Order;

use think\Validate;

// 商品订单的验证器
class Order extends Validate
{
    protected $rule =   [
        'code' => ['require', 'unique:order'], 
        'busid'   => 'require',
        'businessaddrid'   => 'require',
        'amount' => ['require', 'number', '>=:0'],
        'status' => ['number', 'in:0,1,2,3,4'],
    ];

    protected $message  =   [
        'busid.require'     => '用户必须填写',
        'businessaddrid.require'     => '用户收货地址未知',
        'code.require'  => '订单号必须填写',   
        'code.unique'  => '订单号已重复',   
        'amount.require'   => '订单总价必须填写',
        'amount.number'      => '订单总价必须是数字类型',
        'amount.>='      => '订单总价必须大于等于0元',
        'status.number'      => '订单状态的类型有误',
        'status.in'      => '订单状态的值有误',
    ];

}

?>